#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h> 
int main()
{
	int m;
	scanf("%d", &m);
	int a[32];
	int count = 0;
	for (int i = 0; (i < 32) && (m != 0); i++)
	{
		a[i] = m % 2;
		m /= 2;
		count++;
	}
	for (int i = 0; i < count; i++)
	{
		printf("%d ", a[i]);
		i++;
	}
	printf("\n");
	for (int i = 1; i < count; i++)
	{
		printf("%d ", a[i]);
		i++;
	}
	return 0;
}